# Makefile for standard binary (jeudi 7 octobre 2010, 16:42:58 (UTC+0200))
# author : Jerome Baril
# email  : jerome.baril@labri.fr
# 
# Modifications:
# Nicolas Mellado (mellado@labri.fr) [2010/09]: add MAC_OS compilation rules
# Nicolas Mellado (mellado@labri.fr) [2011/09]: add wildcards



HEADERS	=  $(wildcard *.h)
SOURCES	=  $(wildcard *.cpp)
OBJECTS	=  $(SOURCES:.cpp=.o)


TARGET 	= game
CC 	= gcc
CPP 	= g++
CFLAGS 	= -Wall -g

# Detecting OS
UNAME := $(shell uname)
ifeq ($(UNAME),GNU/Linux)
	LIBS 	= -lGL -lGLU -lglut -lm
else ifeq ($(UNAME),Cygwin)
	LIBS 	= -lGL -lGLU -lglut -lm
else # MacIllegal option (snow leopard)
	DEFINES	= -D_MAC_OS_
	LIBS    = -framework GLUT -framework OpenGL -framework Cocoa
endif

INCDIR	= -I . 

$(TARGET): $(OBJECTS) $(HEADERS)
	$(CPP) $(CFLAGS) $(OBJECTS) $(LIBS) -o $@ 

%.o: %.cpp
	$(CPP) -o $@ -c $< $(DEFINES) $(CFLAGS) $(INCDIR)

clean:
	rm -f semantic.cache *.o *~

Clean:
	rm -f semantic.cache  *.o *~ $(TARGET)

edit:
	emacs $(HEADERS) $(SOURCES) 



